<template>
  <div class="page">
    <mt-header fixed title="采购审批列表详情" style="height: 64px;">
      <router-link to="" slot="left">
        <mt-button icon="back" @click="$router.go(-1)">返回</mt-button>
      </router-link>
      <mt-button class="mint-button-text" slot="right" @click="auditTask()">审批</mt-button>
    </mt-header>
    <div class="content">
      <!-- 商品信息-->
      <!-- 加载数据-->
      <div class="loadmore" ref="List">
        <ul class="d-ul-box">
          <li class="d-li-box" v-for="(detail,index) in detailList" :key="index">
            <div class="d-list-box">
              <div class="d-list-line">
                <div class="line-left">商品名称</div>
                <div class="line-right bottom-line">{{detail.pro_name}}</div>
              </div>
              <div class="d-list-line">
                <div class="section-left">
                  <label>商品规格</label><span class="right-value bottom-line">{{detail.pro_guige}}</span>
                </div>
                <div class="section-right">
                  <label>单位</label><span class="right-value bottom-line">{{detail.pro_danwei}}</span>
                </div>
              </div>
              <div class="d-list-line">
                <div class="line-left">生产厂家</div>
                <div class="line-right bottom-line">{{detail.pro_manufactor}}</div>
              </div>
              <div class="d-list-line">
                <div class="section-left">
                  <label class="left-label">数量</label><span class="right-value  bottom-line">{{detail.pro_shengou_shuliang}}</span>
                </div>
                <div class="section-right">
                  <label class="left-label">单价</label><span class="right-value  bottom-line">{{detail.pro_price}}</span>
                </div>
              </div>
            </div><!-- d-list-box -->
          </li>
        </ul>
      </div>


    </div>

  </div>
</template>

<script>

  import {MessageBox, Field} from 'mint-ui'

  export default {
    name: 'page-navbar',
    data() {
      return {
        selected: '1',
        amount: 1000,
        auditOpinion: ''
      }
    },
    computed: {
      detailList() {
        return this.$store.state.medicalPurchasePendingDetail.detailList;
      }
    },
    methods: {
      auditTask() {
        console.log('审批 task');
        //在这里要弹出一个审批框
        const htmls = `
           <div class="ad-msg-box" >

              <div class="ad-msg-line" style="height: 30px;line-height: 30px;width: 275px;background: #ebebeb; text-align: left;padding-left: 8px;padding-right: 8px;"><label class="left-label">金额</label><span class="right-value" style="float:right;">1000元</span></div>
              <div class="ad-msg-line" style="    height: 65px;width: 275px;background: #ebebeb;text-align: left;padding-left: 8px;margin-top: 8px;"><label class="left-label">审批意见</label>
                <textarea class="right-value" id="adopinion" ref="opinion"  style="height: 65px;background: #ebebeb;vertical-align: top;width: 198px;"></textarea>
              </div>
           </div>
        `;
        MessageBox.confirm('', {
          message: htmls,
          title: '审批',
          showConfirmButton: true,
          showCancelButton: true,
          confirmButtonText: '同意',
          cancelButtonText: '不同意'
        }).then(action => {
          // let opinion = document.getElementById('#adopinion');
          // console.log(opinion.value)
          if (action == 'confirm') {
            console.log('abc');
            let opinion = window.document.getElementById('adopinion');
            console.log(opinion.value);
          }
        }).catch(err => {
          if (err == 'cancel') {
            console.log('123');
          }
        });
      }
    },
    mounted() {
      //获取路由参数
      console.log(this.$route.params);
      let params = this.$route.params;
      this.$store.dispatch('getMedicalPurchaseDetail', params);
    }
  }

</script>

<style scoped>
  /*背景*/
  #listInfo {
    background-color: #ebebeb;
  }

  .content {
    margin-top: 0.64rem;
    height: auto;
    background: #ebebeb;
  }

  .d-ul-box {
  }

  .d-li-box {
    font-size: 0.13rem;
    color: #363636;
    background: #fff;
    margin-bottom: 0.08rem;
  }

  .d-list-box {
  }

  .d-list-line {
    display: flex;
    height: 0.30rem;
    line-height: 0.30rem;
    padding-right: 0.04rem;
  }

  .line-left {
    width: 0.78rem;
    padding-left: 0.15rem;
  }

  .line-right {
    flex: 1;
    padding-left: 0.05rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .section-left {
    flex: 1;
    padding-left: 0.15rem;
  }

  .section-right {
    flex: 1;
  }

  .d-list-line .line-right {
  }

  .d-list-line .line-left {
  }

  .section-left label, .section-right label {
  }

  .section-left span, .section-right span {
    margin-left: 0.15rem;
    padding-left: 0.05rem;
    width: 1rem;
    display: inline-block;
  }

  .left-label {
  }

  .right-value {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    vertical-align: middle;
  }

  .bottom-line {
    border-bottom: 1px solid #ececec;
  }


</style>

